package com.loren.tetris.windows.ui;

import com.loren.tetris.data.GameData;
import com.loren.tetris.data.constant.DataConstant;
import com.loren.tetris.utils.AssistiveUtils;

import java.awt.*;

public class BoxGrade extends Box {

    public BoxGrade(int boxX, int boxY, int boxW, int boxH, GameData gameData) {
        super(boxX, boxY, boxW, boxH, gameData);
    }

    @Override
    protected void gameAction(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        this.drawBoxTitle(g2d, "等级");
        int x = this.getBoxX() + 30, y = this.getBoxY() + 95;
        g2d.setColor(DataConstant.COLOR_RED);
        g2d.setFont(new Font(AssistiveUtils.getFontFamily(), Font.PLAIN, 60));
        String gameGrade = this.getGameData().getGameGrade() < 10
                ? "0" + this.getGameData().getGameGrade() : String.valueOf(this.getGameData().getGameGrade());
        g2d.drawString(gameGrade, x, y);
    }
}
